import unittest,requests
class weidu(unittest.TestCase):
    host='http://10.59.9.18'
    userId=None
    sessionId=None

    #登录 login
    def test_01_login(self):
        url=weidu.host+'/movieApi/user/v2/login'
        json={'email':'1028374179@qq.com','pwd':'eWLPHopE945d2ivttHaQTQ=='}
        login=requests.post(url=url,params=json)
        print(login.json())
        weidu.userId=login.json()['result']['userId']
        weidu.sessionId = login.json()['result']['sessionId']
        print(weidu.userId)
        print(weidu.sessionId)

    # #查询看过的电影 findSeenMovie
    # def test_02_findSeenMovie(self):
    #     url=weidu.host+'/movieApi/user/v2/verify/findSeenMovie'
    #     headers={'userId':str(weidu.userId),'sessionId':weidu.sessionId}
    #     findSeenMovie=requests.get(url=url,headers=headers)
    #     print(findSeenMovie.json())

    #查询热门电影列表 findHotMovieList
    movieId=None
    def test_02_findHotMovieList(self):
        url=weidu.host+'/movieApi/movie/v2/findHotMovieList'
        json={'page':1,'count':5}
        findHotMovieList=requests.get(url=url,params=json)
        print(findHotMovieList.json())
        weidu.movieId=findHotMovieList.json()['result'][0]['movieId']
        print(weidu.movieId)

    #查询区域列表
    regionId = None
    def test_03_findeight(self):
        url=weidu.host+'/movieApi/tool/v2/findRegionList'
        findeight=requests.get(url=url)
        print(findeight.json())
        weidu.regionId=findeight.json()['result'][6]['regionId']
        print(weidu.regionId)

    #根据useerId和区域号查看电影时间
    def test_04_findcnam(self):
        url=weidu.host+'/movieApi/movie/v2/findCinemasInfoByRegion'
        json={'movieId':weidu.movieId,'regionId':weidu.regionId,'page':2,'count':5}
        findcnam=requests.get(url=url,params=json)
        print(findcnam.json())





if __name__ == '__main__':
    unittest.main()